:root {
  --cor-fundo: #fcf8f1;
  --cor-botoes: #952129;
  --cor-botoes-hover: #7f1b22;
  --cor-fontes: #000000;
  --cor-linha: #e8ddce;
  --cor-linha-suave: #efe5d8;
  --cor-card: #ffffff;
  --cor-evento-bg: #f4d9dc;
  --cor-evento-borda: #952129;
  --cor-erro: #dc2626;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, sans-serif;
  background: var(--cor-fundo);
  color: var(--cor-fontes);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  border-bottom: 1px solid var(--cor-linha);
  background: var(--cor-fundo);
  position: sticky;
  top: 0;
  z-index: 30;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  color: var(--cor-fontes);
}

.titulo {
  font-weight: bold;
  font-size: 18px;
  flex: 1;
}

.select-visao {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--cor-linha);
  background: #ffffff;
  font-size: 14px;
}

.datebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--cor-fundo);
  border-bottom: 1px solid var(--cor-linha);
  position: sticky;
  top: 56px;
  z-index: 25;
}

.data-atual {
  flex: 1;
  text-align: center;
  color: var(--cor-botoes);
  font-weight: bold;
  cursor: pointer;
}

.btn-primary {
  border: none;
  background: var(--cor-botoes);
  color: #ffffff;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(149, 33, 41, 0.25);
}

.btn-primary:hover {
  background: var(--cor-botoes-hover);
}

.agenda-wrapper {
  flex: 1;
  overflow: auto;
  background: var(--cor-fundo);
}

.agenda {
  min-width: 720px;
  position: relative;
  background: var(--cor-fundo);
}

.prof-header {
  display: grid;
  grid-template-columns: 52px repeat(3, 1fr);
  height: 82px;
  border-bottom: 1px solid var(--cor-linha);
  background: var(--cor-fundo);
  position: sticky;
  top: 0;
  z-index: 20;
}

.prof-spacer,
.prof {
  border-right: 1px solid var(--cor-linha);
  background: var(--cor-fundo);
}

.prof {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: bold;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--cor-botoes);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.grid-agenda {
  display: grid;
  grid-template-columns: 52px repeat(3, 1fr);
  position: relative;
  background: var(--cor-fundo);
}

.hora-label {
  height: 48px;
  border-right: 1px solid var(--cor-linha-suave);
  border-bottom: 1px solid var(--cor-linha-suave);
  font-size: 12px;
  color: #525252;
  padding-top: 4px;
  text-align: right;
  padding-right: 6px;
  background: var(--cor-fundo);
}

.celula {
  height: 48px;
  border-right: 1px solid var(--cor-linha-suave);
  border-bottom: 1px solid var(--cor-linha-suave);
  background: var(--cor-fundo);
  cursor: pointer;
  position: relative;
}

.celula:hover {
  background: #f8f2f2;
}

.evento {
  position: absolute;
  left: 4px;
  right: 4px;
  background: var(--cor-evento-bg);
  border-left: 4px solid var(--cor-evento-borda);
  border-radius: 5px;
  padding: 6px;
  font-size: 12px;
  overflow: hidden;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.evento strong {
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.evento small {
  display: block;
  line-height: 1.2;
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: var(--cor-fundo);
  display: none;
  z-index: 80;
  overflow: auto;
}

.form-topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--cor-linha);
  position: sticky;
  top: 0;
  background: var(--cor-fundo);
  z-index: 90;
}

.form-titulo {
  font-size: 20px;
  font-weight: bold;
}

.form-page {
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 16px 110px;
}

.field-row {
  margin-bottom: 14px;
}

label {
  display: block;
  font-size: 12px;
  color: #525252;
  margin-bottom: 4px;
}

input,
select,
textarea {
  width: 100%;
  padding: 13px 12px;
  border: 1px solid #cfc8b6;
  border-radius: 5px;
  font-size: 15px;
  background: #ffffff;
  color: var(--cor-fontes);
}

textarea {
  min-height: 70px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--cor-botoes);
  box-shadow: 0 0 0 2px rgba(149, 33, 41, 0.12);
}

.bottom-action {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px;
  background: var(--cor-fundo);
  border-top: 1px solid var(--cor-linha);
  z-index: 95;
}

.bottom-action button {
  width: 100%;
  border: none;
  background: var(--cor-botoes);
  color: #ffffff;
  font-weight: bold;
  padding: 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
}

.botoes-edicao {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.botoes-edicao.editando {
  grid-template-columns: 1fr 1fr;
}

.btn-excluir {
  background: var(--cor-erro) !important;
}

.msg {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 12px;
  border-radius: 10px;
  display: none;
  font-size: 14px;
  z-index: 100;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.sucesso {
  background: #dcfce7;
  color: #166534;
}

.erro {
  background: #fee2e2;
  color: #991b1b;
}

.loading {
  padding: 20px;
  color: #525252;
  text-align: center;
}

.autocomplete-box {
  position: relative;
}

.sugestoes {
  position: absolute;
  left: 0;
  right: 0;
  top: 48px;
  background: #ffffff;
  border: 1px solid #cfc8b6;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.16);
  z-index: 120;
  display: none;
  overflow: hidden;
}

.sugestao-item {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--cor-linha-suave);
}

.sugestao-item:hover {
  background: #f8f2f2;
}

.sugestao-item strong {
  display: block;
  font-size: 14px;
}

.sugestao-item small {
  display: block;
  font-size: 12px;
  color: #525252;
  margin-top: 3px;
}

@media (max-width: 760px) {
  .agenda {
    min-width: 620px;
  }

  .datebar {
    gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .btn-primary {
    padding: 10px 12px;
  }

  .botoes-edicao.editando {
    grid-template-columns: 1fr;
  }
}

.update-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 18px;
  background: #952129;
  color: #ffffff;
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: bold;
}

.update-banner button {
  border: none;
  background: #ffffff;
  color: #952129;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: bold;
  cursor: pointer;
}
