:root {
  --roxo: #5b21b6;
  --roxo-claro: #7c3aed;
  --roxo-escuro: #4c1d95;
  --teal: #0d9488;
  --amarelo: #f59e0b;
  --verde: #16a34a;
  --vermelho: #dc2626;
  --cinza-claro: #f3f4f6;
  --cinza-borda: #e5e7eb;
  --texto-escuro: #111827;
  --texto-medio: #6b7280;
}

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

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, Arial, sans-serif;
  background: linear-gradient(145deg, var(--roxo-escuro) 0%, var(--teal) 100%);
  background-attachment: fixed;
  color: var(--texto-escuro);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────── */

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.center-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ── Cards ──────────────────────────────────────────── */

.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 16px rgba(0,0,0,.1);
  padding: 24px;
  margin-bottom: 20px;
  color: var(--texto-escuro);
}

.card h2 {
  font-size: 1em;
  font-weight: 700;
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--cinza-borda);
  color: var(--roxo-escuro);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Topbar ─────────────────────────────────────────── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 10px 16px;
  margin-bottom: 14px;
}

.topbar-esq {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-logo {
  height: 42px;
  width: auto;
  border-radius: 6px;
  flex-shrink: 0;
}

.topbar-titulo {
  font-size: 1.05em;
  font-weight: 700;
  color: #fff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-acoes {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.topbar button {
  background: rgba(255,255,255,.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: .85em;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.topbar button:hover { background: rgba(255,255,255,.32); }

/* ── Nav tabs ───────────────────────────────────────── */

.nav-equipe {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.nav-equipe a {
  padding: 9px 18px;
  border-radius: 10px;
  background: rgba(255,255,255,.18);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: .92em;
  transition: .15s;
}
.nav-equipe a:hover { background: rgba(255,255,255,.28); }
.nav-equipe a.ativo { background: var(--amarelo); color: #222; }

/* ── Status / Alerts ────────────────────────────────── */

.status {
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .9em;
  margin: 10px 0;
  display: none;
}
.status.show { display: block; }
.status.erro  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.status.sucesso { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* ── Buttons ────────────────────────────────────────── */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
  background: var(--roxo);
  color: #fff;
}
button:hover:not(:disabled) { background: var(--roxo-claro); }
button:disabled { opacity: .5; cursor: not-allowed; }
button:active:not(:disabled) { transform: scale(.98); }

button.sec {
  background: var(--cinza-claro);
  color: var(--texto-escuro);
  border: 1px solid var(--cinza-borda);
}
button.sec:hover:not(:disabled) { background: var(--cinza-borda); }

button.danger { background: var(--vermelho); }
button.danger:hover:not(:disabled) { background: #b91c1c; }

button.small { padding: 7px 12px; font-size: .83em; }

/* ── Form elements ──────────────────────────────────── */

label {
  display: block;
  margin: 14px 0 5px;
  font-weight: 600;
  font-size: .85em;
  color: var(--texto-medio);
  text-transform: uppercase;
  letter-spacing: .03em;
}

input, select, textarea {
  font: inherit;
  border: 1.5px solid var(--cinza-borda);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
  background: #fff;
  color: var(--texto-escuro);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--roxo-claro);
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}
textarea { resize: vertical; min-height: 80px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 140px; }

/* ── Typography ─────────────────────────────────────── */

h1, h2, h3 { margin: 0 0 8px; font-weight: 700; }
h1 { font-size: 1.5em; }
h3 { font-size: 1.05em; color: var(--roxo-escuro); }
.muted { color: var(--texto-medio); font-size: .9em; }
p { margin: 0 0 8px; }

/* ── Tables ─────────────────────────────────────────── */

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

table { width: 100%; border-collapse: collapse; font-size: .9em; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--cinza-borda); }
th {
  font-size: .78em;
  text-transform: uppercase;
  color: var(--texto-medio);
  font-weight: 700;
  letter-spacing: .04em;
  background: var(--cinza-claro);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f9f8ff; }

/* ── Badges ─────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .78em;
  font-weight: 700;
  background: #ede9fe;
  color: var(--roxo-escuro);
}
.badge.inativo { background: #fee2e2; color: #991b1b; }
.badge.ativo   { background: #dcfce7; color: #166534; }

/* ── Agenda / Grade ─────────────────────────────────── */

.dia-titulo {
  font-weight: 700;
  color: var(--texto-medio);
  font-size: .92em;
  margin: 10px 0 16px;
}

.turno-titulo {
  font-size: .78em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--texto-medio);
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--cinza-borda);
}

.duas-colunas { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .duas-colunas { grid-template-columns: 1fr; } }

.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }

.slot {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: .15s;
  border: 1.5px solid transparent;
}
.slot:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.slot.livre   { background: #dcfce7; border-color: #86efac; color: #166534; }
.slot.parcial { background: #fef9c3; border-color: #fde047; color: #854d0e; }
.slot.cheio   { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.slot.sem-detalhe {
  background: var(--cinza-claro);
  border-color: var(--cinza-borda);
  color: var(--texto-medio);
  cursor: default;
}
.slot.sem-detalhe:hover { transform: none; box-shadow: none; }
.slot .hora { font-weight: 700; font-size: .95em; }
.slot small { display: block; margin-top: 3px; font-size: .8em; opacity: .9; }

/* ── Itens de atendimento ───────────────────────────── */

.item-atendimento {
  background: var(--cinza-claro);
  border: 1.5px solid var(--cinza-borda);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.item-obs div { margin-bottom: 4px; font-size: .9em; color: var(--texto-escuro); }
.item-obs div strong { color: var(--texto-medio); font-size: .85em; text-transform: uppercase; margin-right: 4px; }

/* ── Modais ─────────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal.show { display: flex; }

.modal-box {
  width: min(540px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  color: var(--texto-escuro);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-box h3 { margin-bottom: 16px; color: var(--roxo-escuro); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ── Credencial ─────────────────────────────────────── */

.credencial-box {
  background: #f5f3ff;
  border: 1.5px solid #c4b5fd;
  border-radius: 10px;
  padding: 16px;
  margin: 14px 0;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 1em;
  color: var(--roxo-escuro);
  line-height: 1.8;
}

/* ── Login ──────────────────────────────────────────── */

.login-logo {
  height: 90px;
  width: auto;
  border-radius: 12px;
  display: block;
  margin: 0 auto 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

.login-titulo {
  text-align: center;
  margin-bottom: 4px;
  color: var(--roxo-escuro);
}

/* ── Voltar link ────────────────────────────────────── */

.voltar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,.9);
  text-decoration: none;
  font-weight: 600;
  font-size: .9em;
  margin-bottom: 14px;
  transition: opacity .15s;
}
.voltar-link:hover { opacity: .75; }

/* ── Misc ───────────────────────────────────────────── */

.footer { text-align: center; padding: 20px; color: rgba(255,255,255,.7); font-size: .85em; }
.hidden { display: none !important; }

/* ── Input com botão ver senha ──────────────────────────────────────────── */

.input-senha-wrap {
  position: relative;
}
.input-senha-wrap input {
  padding-right: 42px;
}
.btn-olho {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  color: var(--texto-medio);
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 4px;
}
.btn-olho:hover { color: var(--texto-escuro); background: none; }
