:root {
  --bg: #f4f6f8;
  --col-bg: #e9edf1;
  --card-bg: #ffffff;
  --border: #d7dde3;
  --text: #2b3640;
  --muted: #6b7785;
  --accent: #2563eb;

  /* prioridades */
  --pri-baixa: #6b7785;
  --pri-media: #2563eb;
  --pri-alta: #ea8a23;
  --pri-urgente: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

/* ===================== LOGIN ===================== */
.tela-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card-login {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.card-login h1 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.subtitulo {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.85rem;
}

.card-login label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 12px 0 4px;
}

.card-login input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}

.card-login button {
  margin-top: 20px;
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.card-login button:disabled { opacity: 0.6; cursor: default; }

.erro {
  color: var(--pri-urgente);
  font-size: 0.85rem;
  margin: 12px 0 0;
  min-height: 1em;
}

/* ===================== TOPO ===================== */
.topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.topo h1 { margin: 0; font-size: 1.15rem; }

.topo-dir {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topo-dir label { font-size: 0.85rem; color: var(--muted); }

.topo-dir select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.usuario-email { font-size: 0.8rem; color: var(--muted); }

#btn-sair {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

#btn-sair:hover { background: var(--col-bg); }

/* ===================== KANBAN ===================== */
.kanban {
  display: flex;
  gap: 14px;
  padding: 18px;
  overflow-x: auto;
  align-items: flex-start;
}

.coluna {
  background: var(--col-bg);
  border-radius: 10px;
  min-width: 260px;
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 110px);
}

.coluna-titulo {
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.coluna-contador {
  background: #cfd6dd;
  color: var(--text);
  border-radius: 10px;
  padding: 1px 9px;
  font-size: 0.75rem;
  font-weight: 600;
}

.coluna-lista {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 60px;
}

/* destaque ao arrastar sobre a coluna */
.coluna.drag-over { outline: 2px dashed var(--accent); outline-offset: -4px; }

/* ===================== CARD ===================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card:active { cursor: grabbing; }
.card.dragging { opacity: 0.5; }

.card-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.card-codigo { font-size: 0.75rem; color: var(--muted); font-weight: 700; }

.card-titulo {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0 0 8px;
  line-height: 1.3;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-unidade { background: #e3e9f0; color: #334155; }
.badge-categoria { background: #eef2f5; color: var(--muted); }

/* prioridades */
.badge-prioridade { color: #fff; }
.prioridade-baixa { background: var(--pri-baixa); }
.prioridade-media { background: var(--pri-media); }
.prioridade-alta { background: var(--pri-alta); }
.prioridade-urgente { background: var(--pri-urgente); }

.card-local {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin: 2px 0 6px;
}

.card-solicitante {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

.card { cursor: pointer; }

.card-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-obs-icone {
  font-size: 0.85rem;
}

/* ===================== MODAL POPUP ===================== */
.modal-popup {
  position: fixed;
  z-index: 1000;
  width: 320px;
  filter: drop-shadow(0 6px 24px rgba(0,0,0,0.16));
}

.modal-popup-seta {
  width: 16px;
  height: 10px;
  margin-left: 24px;
  background: var(--card-bg);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.modal-popup-corpo {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--border);
}

.modal-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.modal-fechar {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
}

.modal-fechar:hover { background: var(--col-bg); color: var(--text); }

.modal-titulo {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 2px;
}

.modal-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

.modal-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.modal-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.modal-textarea:focus { border-color: var(--accent); background: #fff; }

.modal-acoes {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-cancelar {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-cancelar:hover { background: var(--col-bg); }

.btn-salvar {
  padding: 7px 16px;
  border: none;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-salvar:hover { background: #1d4ed8; }
.btn-salvar:disabled { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 640px) {
  .kanban { flex-direction: column; }
  .coluna { width: 100%; max-height: none; }
  .modal-popup { width: calc(100vw - 16px); left: 8px !important; }
}
