/* Login, perfil e painel de usuários */

.user-info {
  font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 260px;
}

.modal {
  position: fixed; inset: 0; background: rgba(8, 15, 24, .55);
  display: grid; place-items: center; z-index: 1500; padding: 16px;
}
.modal-card {
  background: var(--panel); color: var(--text); border-radius: 12px; box-shadow: var(--shadow);
  width: min(960px, 100%); max-height: calc(100vh - 32px); overflow: hidden;
  display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 17px; }

.admin-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  min-height: 0; overflow: hidden; flex: 1;
}
.users-col, .form-col { padding: 16px 18px; overflow-y: auto; min-height: 0; min-width: 0; }
.users-col { border-right: 1px solid var(--border); display: grid; align-content: start; gap: 12px; }
.form-col h3 { margin: 0 0 10px; font-size: 15px; }

.user-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.user-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center;
  cursor: pointer;
}
.user-item:hover, .user-item.active { border-color: var(--brand); background: var(--sel-bg); }
.user-item .uname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-item .usub { color: var(--muted); font-size: 12px; grid-column: 1 / -1; }
.role-chip {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--sel-bg); border: 1px solid var(--border);
}
.role-chip.admin { border-color: var(--brand); color: var(--brand); }
.link-danger {
  background: none; border: 0; color: var(--old); cursor: pointer; font-size: 12px; padding: 2px 0;
  grid-column: 1 / -1; justify-self: start;
}

.user-form { display: grid; gap: 12px; }
.user-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.user-form input, .user-form select {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; color: var(--text); font: inherit;
}
.hint { font-size: 12px; color: var(--muted); }
.tag-assign { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: grid; gap: 8px; min-width: 0; }
.tag-assign legend { padding: 0 6px; color: var(--muted); font-size: 13px; }
.tag-check-list {
  max-height: 240px; overflow-y: auto; display: grid; gap: 2px;
  border: 1px solid var(--border); border-radius: 8px; padding: 4px;
}
.tag-check {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.tag-check:hover { background: var(--sel-bg); }
.tag-check input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.tag-check .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-check .small { color: var(--muted); font-size: 12px; }

.danger-btn {
  border-radius: 8px; padding: 7px 11px; cursor: pointer; font-size: 13px;
  border: 1px solid var(--old); background: var(--old); color: #fff;
}

/* login: campo de usuário e senha já existem em index.html */

@media (max-width: 760px) {
  .admin-grid { grid-template-columns: 1fr; overflow-y: auto; }
  .users-col { border-right: 0; border-bottom: 1px solid var(--border); }
  .modal-card { max-height: calc(100vh - 24px); }
  .user-info { display: none; }
}

/* Nome da tag no painel de detalhes */
.name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.name-row h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn.small { width: 30px; height: 30px; flex: none; color: var(--muted); }
.icon-btn.small:hover { color: var(--text); }
.rename-form { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.rename-form input {
  flex: 1 1 160px; height: 36px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit;
}
.rename-form input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Modal pequeno (troca de senha) */
.modal-card.narrow { width: min(440px, 100%); }
.modal-form { padding: 18px; display: grid; gap: 12px; }
.modal-form .error { margin: 0; font-size: 14px; }
.modal-form .row.actions { margin-top: 4px; }
