/* PlantonIA - Painel Piloto v0. Identidade: teal + verde (WhatsApp-adjacent, sem
   copiar o app), creme de fundo, serifada em destaques + sans no corpo. Fontes via
   pilha do sistema (sem CDN de fonte) - degrada bem sem depender de rede externa. */

:root {
  --teal: #075e54;
  --teal-dark: #054139;
  --teal-light: #0f7a6c;
  --green: #25d366;
  --cream: #f7f2e7;
  --cream-card: #fffdf8;
  --ink: #16231f;
  --ink-soft: #4a5a54;
  --border: #e4dcc8;
  --danger: #c1432f;
  --danger-bg: #fbe6e1;
  --shadow: 0 12px 32px -12px rgba(7, 94, 84, 0.28);
  --radius-lg: 20px;
  --radius-md: 14px;
  --font-display: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", ui-sans-serif, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
  color: var(--teal-dark);
}

a {
  color: var(--teal);
}

/* --- Login --- */

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}

@media (max-width: 780px) {
  .login-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
}

.login-brand {
  background: radial-gradient(circle at 20% 20%, var(--teal-light), var(--teal-dark) 70%);
  color: #fdfbf5;
  padding: clamp(2rem, 6vw, 4.5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.1rem;
}

.login-brand .mark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 600;
}

.login-brand .dot {
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(37, 211, 102, 0.18);
}

.login-brand p {
  max-width: 34ch;
  color: rgba(253, 251, 245, 0.82);
  line-height: 1.55;
}

.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 5vw, 3rem);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--cream-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(1.6rem, 4vw, 2.4rem);
}

.login-card h2 {
  font-size: 1.5rem;
}

.login-card .subtitle {
  color: var(--ink-soft);
  margin: 0 0 1.6rem;
  font-size: 0.94rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input {
  font: inherit;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(7, 94, 84, 0.15);
}

.btn-primary {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px -8px rgba(7, 94, 84, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.form-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(193, 67, 47, 0.25);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  margin-bottom: 1.1rem;
}

/* --- Shell autenticado --- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--teal-dark);
  color: #fdfbf5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem clamp(1rem, 4vw, 2.4rem);
}

.topbar .mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar .mark .dot {
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--green);
}

.topbar .session {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: rgba(253, 251, 245, 0.85);
}

.topbar .session a {
  color: #fdfbf5;
  background: rgba(255, 255, 255, 0.12);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  transition: background 150ms ease;
}

.topbar .session a:hover {
  background: rgba(255, 255, 255, 0.22);
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
    row-gap: 0.6rem;
  }

  .topbar .session {
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.82rem;
  }

  .topbar .session a {
    padding: 0.35rem 0.7rem;
  }
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(1.2rem, 4vw, 2.4rem);
}

.page-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.page-heading h1 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}

.filter-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.filter-form select {
  font: inherit;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink);
}

.btn-filter {
  font: inherit;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--teal);
  background: #fff;
  color: var(--teal);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.btn-filter:hover {
  background: var(--teal);
  color: #fff;
}

/* --- Cards de cliente --- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.client-card {
  background: var(--cream-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.client-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--teal-light);
}

.client-card .nome {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--teal-dark);
  margin-bottom: 0.15rem;
}

.client-card .especialidade {
  color: var(--ink-soft);
  font-size: 0.86rem;
  margin-bottom: 0.8rem;
}

.client-card .stats {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.stat-pill {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(7, 94, 84, 0.09);
  color: var(--teal-dark);
}

.stat-pill.crisis {
  background: var(--danger-bg);
  color: var(--danger);
}

/* --- Lista de escalonamentos --- */

.panel {
  background: var(--cream-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.3rem 1.4rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-bottom: 0.9rem;
}

.panel-head h2 {
  margin-bottom: 0;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.live-dot::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.2);
}

.escalation-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.escalation-row:last-child {
  border-bottom: none;
}

.escalation-row .when {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.escalation-row .reason {
  min-width: 0;
}

.escalation-row .client {
  color: var(--teal-dark);
  font-weight: 600;
}

.badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(7, 94, 84, 0.09);
  color: var(--teal-dark);
  white-space: nowrap;
}

.badge.crisis {
  background: var(--danger);
  color: #fff;
}

.empty-state {
  color: var(--ink-soft);
  font-size: 0.92rem;
  padding: 1rem 0;
}

@media (max-width: 640px) {
  .escalation-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

/* --- Perfil do cliente --- */

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  text-decoration: none;
  font-weight: 600;
}

.profile-header {
  background: var(--cream-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.4rem;
}

.profile-header .especialidade-pill {
  display: inline-block;
  margin-top: 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--teal-dark);
  background: rgba(7, 94, 84, 0.09);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.prose {
  background: var(--cream-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.3rem, 4vw, 2.2rem);
  line-height: 1.65;
}

.prose h1, .prose h2, .prose h3 {
  margin-top: 1.4em;
}

.prose h1:first-child, .prose h2:first-child, .prose h3:first-child {
  margin-top: 0;
}

.prose blockquote {
  margin: 1rem 0;
  padding: 0.2rem 1rem;
  border-left: 3px solid var(--green);
  color: var(--ink-soft);
}

.prose ul {
  padding-left: 1.3rem;
}

.not-found {
  text-align: center;
  padding: 4rem 1rem;
}

/* --- Mensagens de sucesso e links auxiliares (acesso/convite) --- */

.form-success {
  background: rgba(37, 211, 102, 0.14);
  color: var(--teal-dark);
  border: 1px solid rgba(37, 211, 102, 0.35);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  margin-bottom: 1.1rem;
}

.login-links {
  text-align: center;
  font-size: 0.86rem;
  margin: 1rem 0 0;
}

.login-links a {
  font-weight: 600;
  text-decoration: none;
}

.login-links a:hover {
  text-decoration: underline;
}

/* --- Minha conta --- */

.conta-header,
.conta-card {
  max-width: 420px;
}

.conta-email {
  color: var(--ink-soft);
  margin: 0.4rem 0 0;
}

/* --- Usuárias (gestão, admin) --- */

.usuarias-convidar {
  margin-bottom: 1.4rem;
}

.usuaria-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.usuaria-row:last-child {
  border-bottom: none;
}

.usuaria-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.usuaria-nome {
  font-weight: 700;
  color: var(--teal-dark);
}

.usuaria-email {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.usuaria-meta {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.usuaria-acoes {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.usuaria-acoes form {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.mini-invite-form input[type="email"] {
  font: inherit;
  font-size: 0.86rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink);
  width: 12rem;
  max-width: 40vw;
}
