/* ITNex N1 Help Desk — visual de suporte interno (não dashboard genérico) */

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap");

:root {
  --ink: #0f1c24;
  --ink-muted: #3d5260;
  --paper: #f3f6f4;
  --surface: #ffffff;
  --brand: #0b6e4f;
  --brand-deep: #064c37;
  --brand-soft: #d8efe6;
  --accent: #c45c26;
  --line: #c9d5ce;
  --ok: #1a7a4c;
  --warn: #b45309;
  --high: #b91c1c;
  --radius: 6px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --shadow: 0 12px 40px rgba(15, 28, 36, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #c5e8da 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, #e8efe9 0%, transparent 50%),
    linear-gradient(180deg, #eef3f0 0%, var(--paper) 40%, #e8eeea 100%);
  line-height: 1.5;
}

a {
  color: var(--brand-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--brand);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: rgba(243, 246, 244, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  color: var(--brand-deep);
}

.brand-sub {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

.nav-hint {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-muted);
}

.nav-links a:hover {
  color: var(--brand-deep);
}

.inline-form {
  display: inline;
  margin: 0;
}

button.linkish {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--ink-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

button.linkish.danger {
  color: var(--high);
}

.flash-list {
  list-style: none;
  margin: 0;
  padding: 0.75rem clamp(1.25rem, 4vw, 3rem);
}

.flash {
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.flash-ok {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.flash-warn {
  background: #ffedd5;
  color: var(--warn);
}

.narrow {
  max-width: 28rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise 0.65s ease-out both;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.auth-form input,
.auth-form textarea,
.auth-form select {
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.form-error {
  margin: 0;
  padding: 0.55rem 0.7rem;
  background: #fee2e2;
  color: var(--high);
  border-radius: 4px;
  font-size: 0.88rem;
}

.btn-primary {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.6rem 1rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn-primary:hover {
  background: var(--brand-deep);
  color: #fff;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.run-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.run-form select {
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.ticket-summary {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-muted);
  line-height: 1.45;
}

.badge.status-resolvido {
  background: var(--brand-soft);
  color: var(--ok);
}

.badge.status-em_analise {
  background: #ffedd5;
  color: var(--warn);
}

.banner-warn {
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  background: #ffedd5;
  border: 1px solid #fdba74;
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.static-row {
  cursor: default;
}

.static-row:hover {
  transform: none;
}

.row-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.event-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.event-list li {
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.event-kind {
  font-weight: 700;
  color: var(--brand-deep);
  margin-right: 0.75rem;
}

.event-at {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.event-detail {
  margin: 0.45rem 0 0;
  white-space: pre-wrap;
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
}

.empty {
  color: var(--ink-muted);
}

.muted {
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.hint {
  font-weight: 400;
  font-size: 0.8rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.login-hero {
  padding-bottom: 1rem;
}

.chat-hero {
  padding-bottom: 1rem;
}

.chat-main {
  max-width: 40rem;
}

.llm-meta {
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.llm-meta p {
  margin: 0.25rem 0 0;
}

.llm-meta code {
  font-size: 0.85rem;
  word-break: break-all;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: rise 0.65s ease-out both;
}

.chat-log {
  min-height: 16rem;
  max-height: min(55vh, 28rem);
  overflow-y: auto;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-bubble {
  max-width: 92%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.chat-user {
  align-self: flex-end;
  background: var(--brand-soft);
  border-color: #a8d4c4;
}

.chat-assistant {
  align-self: flex-start;
  background: #fff;
}

.chat-role {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.25rem;
}

.chat-text {
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.5;
}

.chat-form {
  display: flex;
  gap: 0.55rem;
  align-items: flex-end;
}

.chat-form textarea {
  flex: 1;
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  resize: vertical;
  min-height: 2.75rem;
}

.chat-form .btn-primary {
  margin-top: 0;
  white-space: nowrap;
}

.chat-status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.hero {
  padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1.25rem, 4vw, 3rem) 2rem;
  max-width: 52rem;
  animation: rise 0.7s ease-out both;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 2.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
}

.hero p {
  margin: 0;
  max-width: 36rem;
  font-size: 1.05rem;
  color: var(--ink-muted);
}

.main {
  padding: 0 clamp(1.25rem, 4vw, 3rem) 3.5rem;
  max-width: 52rem;
}

.section-label {
  margin: 0 0 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
}

.ticket-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  animation: rise 0.7s 0.12s ease-out both;
}

.ticket-row {
  display: block;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.ticket-row:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.ticket-row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  margin-bottom: 0.35rem;
}

.ticket-id {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand-deep);
}

.ticket-row h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.ticket-row-meta {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.badge.priority-alta {
  background: #fee2e2;
  color: var(--high);
}

.badge.priority-media {
  background: #ffedd5;
  color: var(--warn);
}

.badge.priority-baixa {
  background: #e0e7ff;
  color: #3730a3;
}

.ticket-detail {
  animation: rise 0.65s ease-out both;
}

.ticket-detail .back {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.ticket-title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.2vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.ticket-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.65rem 1.25rem;
  margin: 0 0 1.75rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.ticket-meta dt {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 0.15rem;
}

.ticket-meta dd {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
}

.ticket-body-label {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* Seletor estável para Playwright — não renomear sem atualizar o agente */
.ticket-description {
  margin: 0;
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: pre-wrap;
  font-size: 0.98rem;
  line-height: 1.6;
  box-shadow: var(--shadow);
  animation: fade-in 0.8s 0.15s ease both;
}

.site-footer {
  padding: 1.5rem clamp(1.25rem, 4vw, 3rem) 2rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
  border-top: 1px solid var(--line);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
